if SERVER then
	registerCommand("teleport", "Teleports the caller to where they're looking", function(param)
		if not param[1]:IsValid() then
			return nil
		end
		
		local teleMsg = "caller teleported"
		local teleSound = "ambient/machines/teleport3.wav" //teleport1.wav also sounds nice
		if param["settings"]["tele_msg"] then
			teleMsg = param["settings"]["tele_msg"]
		end
		if param["settings"]["tele_sound"] then
			teleSound = param["settings"]["tele_sound"]
		end
		local teleTable = {}
		teleTable["caller"] = getCaller(param[1])
		
		local maxRange = -1
		if param["settings"]["tele_range"] then
			maxRange = param["settings"]["tele_range"]
		end
		maxRange = tonumber(maxRange)
		local tr = param[1]:GetEyeTrace()
		if maxRange < 0 || param[1]:GetPos():Distance(tr.HitPos) <= maxRange then
			param[1]:SetPos(tr.HitPos - (param[1]:GetAimVector() * 30))
		else
			param[1]:SetPos(param[1]:GetPos() + param[1]:GetAimVector() * maxRange)//(tr.HitPos - param[1]:GetPos()):Angle():Forward() * maxRange)
		end
		param[1]:EmitSound(teleSound)
		display(param[1], "teleport", { plyTarg }, parseDisplayMessage(teleMsg, teleTable))
	end)
end